Skip Navigation
blueberry

Coder, Artist, Blogger (https://fungiverse.wordpress.com/, https://philpapers.org/archive/BINAKR.pdf), Former Admin of diagonlemmy.social, Programmer of MyceliumWebServer

Posts
22
Comments
6
Joined
3 wk. ago
AI Detox @feddit.org
blueberry @feddit.org

99 Haskell Problems - Problem 3

Problem 3

(*) Find the K'th element of a list. Solutions

The first element in the list is number 1. Example:

 undefined
    
* (element-at '(a b c d e) 3)
c

  

Example in Haskell:

elementAt [1,2,3] 2

2

elementAt "haskell" 5

'e'

AI Detox @feddit.org
blueberry @feddit.org

99 Haskell Problems - Problem 2

Problem 2

(*) Find the last-but-one (or second-last) element of a list.

(Note that the Lisp transcription of this problem is incorrect.)

Example in Haskell:

myButLast [1,2,3,4]

3

myButLast ['a'..'z']

'y'

Source: https://wiki.haskell.org/index.php?title=99_questions%2F1_to_10

AI Detox @feddit.org
blueberry @feddit.org

Haskell Wiki - 99 Question - Question 2

Problem 2

(*) Find the last-but-one (or second-last) element of a list. Solutions

(Note that the Lisp transcription of this problem is incorrect.)

Example in Haskell:

myButLast [1,2,3,4]

3

myButLast ['a'..'z']

'y'

  • Yeah, it's great, it's both gentle and powerful

  • AI Detox @feddit.org
    blueberry @feddit.org

    Swamp Thing : the saga of the Swamp Thing by Moore, Alan, 1953

    AI Detox @feddit.org
    blueberry @feddit.org

    AI Detox: read the complete Wikipedia article about Otokichi, a Japanese castaway who floated all the way to America. The journey took 14 months.

    AI Detox @feddit.org
    blueberry @feddit.org

    AI Detox: Write a Haiku about Linux

    AI Detox @feddit.org
    blueberry @feddit.org

    Ninety-Nine Haskell Problems - Problem 1

    Problem 1

    (*) Find the last element of a list. Solutions

    (Note that the Lisp transcription of this problem is incorrect.)

    Example in Haskell:

    myLast [1,2,3,4]

    4

    myLast ['x','y','z']

    'z'

    Papertronics @feddit.org
    blueberry @feddit.org

    MarblePunk Puzzle "Which mathematical function is calculated here?" (hard)

    Distributed Machine Learning @feddit.org
    blueberry @feddit.org

    BOINC: How You Can Contribute to Scientific Research Without Doing Anything

    Puzzles @lemmy.ml
    blueberry @feddit.org

    MarblePunk Puzzle "Factorial Calculator" (expert)

    cross-posted from: https://feddit.org/post/14593429

    Factorial Calculator

    Difficulty: Expert

    Game Overview

    Design a physical track where a marble rolls and executes programming instructions. The marble carries a value and performs calculations as it hits different track pieces.

    Puzzle

    Calculate the factorial of 4 (4! = 4 × 3 × 2 × 1) and output the result 24.

    Starting Conditions:

    • Marble begins carrying the value: 4
    • Expected output: 24

    Available Track Pieces (Use Each Once):

    • 2× CURVE - Changes marble direction 90°
    • 1× STRAIGHT - Continues marble in same direction
    • 1× LOOP-TRACK - Connects track to form a physical loop
    • 1× BRANCH-ZERO - Marble goes LEFT if carrying 0, RIGHT otherwise
    • 1× SUBTRACT-1 - Subtracts 1 from marble's value
    • 1× MULTIPLY - Multiplies marble's value by memory slot A
    • 1× STORE-A - Saves marble's current value to memory slot A
    • **1× LOAD-A
    Papertronics @feddit.org
    blueberry @feddit.org

    MarblePunk Puzzle "Factorial Calculator" (expert)

    Factorial Calculator

    Difficulty: Expert

    Game Overview

    Design a physical track where a marble rolls and executes programming instructions. The marble carries a value and performs calculations as it hits different track pieces.

    Puzzle

    Calculate the factorial of 4 (4! = 4 × 3 × 2 × 1) and output the result 24.

    Starting Conditions:

    • Marble begins carrying the value: 4
    • Expected output: 24

    Available Track Pieces (Use Each Once):

    • 2× CURVE - Changes marble direction 90°
    • 1× STRAIGHT - Continues marble in same direction
    • 1× LOOP-TRACK - Connects track to form a physical loop
    • 1× BRANCH-ZERO - Marble goes LEFT if carrying 0, RIGHT otherwise
    • 1× SUBTRACT-1 - Subtracts 1 from marble's value
    • 1× MULTIPLY - Multiplies marble's value by memory slot A
    • 1× STORE-A - Saves marble's current value to memory slot A
    • 1× LOAD-A - Loads value from memory slot A into marble
    • 1× OUTPUT - Displays marble's current value
    • **1× HAL
    Puzzles @sopuli.xyz
    blueberry @feddit.org

    PaperBugs Puzzle "Waltz" (medium)

    cross-posted from: https://feddit.org/post/14591777

    Game Description:

    PaperBugs is a puzzle where you control bugs on a grid by writing a simple program. Each bug executes the same program step-by-step to reach their targets. The key challenge is that ALL bugs run the SAME program simultaneously!

    Puzzle:

    Available instructions:

    • MOVE - move forward one cell
    • LEFT / RIGHT - rotate 90 degrees
    • IF FLOWER - execute next line only if flower ahead
    • IF EMPTY - execute next line only if path clear
    • IF WALL - execute next line only if wall ahead
    • IF GEM - execute next line only if gem ahead

    Board:

    Legend:

    • Flower (blocks movement)
    • Gem (collectable)
    • Wall (blocks movement)

    Goal:

    Write a single program that guides both bugs to collect gems and reach their targets safely.

    Puzzles @lemmy.ml
    blueberry @feddit.org

    PaperBugs Puzzle "Waltz" (medium)

    cross-posted from: https://feddit.org/post/14591777

    Game Description:

    PaperBugs is a puzzle where you control bugs on a grid by writing a simple program. Each bug executes the same program step-by-step to reach their targets. The key challenge is that ALL bugs run the SAME program simultaneously!

    Puzzle:

    Available instructions:

    • MOVE - move forward one cell
    • LEFT / RIGHT - rotate 90 degrees
    • IF FLOWER - execute next line only if flower ahead
    • IF EMPTY - execute next line only if path clear
    • IF WALL - execute next line only if wall ahead
    • IF GEM - execute next line only if gem ahead

    Board:

    Legend:

    • Flower (blocks movement)
    • Gem (collectable)
    • Wall (blocks movement)

    Goal:

    Write a single program that guides both bugs to collect gems and reach their targets safely.

    Papertronics @feddit.org
    blueberry @feddit.org

    PaperBugs Puzzle "Waltz" (medium)

    Game Description:

    PaperBugs is a puzzle where you control bugs on a grid by writing a simple program. Each bug executes the same program step-by-step to reach their targets. The key challenge is that ALL bugs run the SAME program simultaneously!

    Puzzle:

    Available instructions:

    • MOVE - move forward one cell
    • LEFT / RIGHT - rotate 90 degrees
    • IF FLOWER - execute next line only if flower ahead
    • IF EMPTY - execute next line only if path clear
    • IF WALL - execute next line only if wall ahead
    • IF GEM - execute next line only if gem ahead

    Board:

    Legend:

    • Flower (blocks movement)
    • Gem (collectable)
    • Wall (blocks movement)

    Goal:

    Write a single program that guides both bugs to collect gems and reach their targets safely.

    Papertronics @feddit.org
    blueberry @feddit.org

    PaperBugs Puzzle "Heavy Lifter" (easy)

    Game Description:

    PaperBugs is a puzzle where you control bugs on a grid by writing a simple program. Each bug executes the same program step-by-step to reach their targets. Heavy bugs have special abilities! Available Instructions:

    • MOVE - move forward one cell
    • LEFT / RIGHT - rotate 90 degrees
    • IF FLOWER - execute next line only if flower ahead
    • IF EMPTY - execute next line only if path clear
    • IF ROCK - execute next line only if rock ahead
    • PUSH - push a rock forward (Heavy Bug only)

    Puzzle:

    Special Rule: Heavy Bug can push rocks with the PUSH command, but only into empty spaces.

    Goal:

    Push rocks to create a safe path and reach the target.

    Papertronics @feddit.org
    blueberry @feddit.org

    PaperBugs Puzzle "Avoid the flower" (easy)

    Puzzle Description:

    PaperBugs is a little puzzle where you control bugs on a grid by writing a simple program. Each bug executes the same program step-by-step to reach their targets.

    Instructions:

    • MOVE - move forward one cell
    • LEFT / RIGHT - rotate 90 degrees
    • IF FLOWER - execute next line only if flower ahead (the next cell the bug is currently facing)
    • IF EMPTY - execute next line only if path clear

    Puzzle - "Avoid the flower" (Easy)

    • [ ][ ][T]
    • [B][F][ ]
    • [ ][ ][ ]

    Legend:

    • B: Bug (starts facing right)
    • T: Target
    • F: Flower
    • [ ]: Empty space

    Goal: Get the bug to the target.

    Distributed Machine Learning @feddit.org
    blueberry @feddit.org
    www.ibm.com What Is Edge AI? | IBM

    Edge AI refers to the deployment of AI models directly on local edge devices to enable real-time data processing and analysis without reliance on cloud infrastructure.

    What Is Edge AI? | IBM
    Distributed Machine Learning @feddit.org
    blueberry @feddit.org

    FedCVG: a two-stage robust federated learning optimization algorithm

    Abstract

    Federated learning provides an effective solution to the data privacy issue in distributed machine learning. However, distributed federated learning systems are inherently susceptible to data poisoning attacks and data heterogeneity. Under conditions of high data heterogeneity, the gradient conflict problem in federated learning becomes more pronounced, making traditional defense mechanisms against poisoning attacks less adaptable between scenarios with and without attacks. To address this challenge, we design a two-stage federated learning framework for defending against poisoning attacks—FedCVG. During implementation, FedCVG first removes malicious clients using a reputation-based clustering method, and then optimizes communication overhead through a virtual aggregation mechanism. Extensive experimental results show that, compared to other baseline methods, FedCVG improves average accuracy by 4.2% and reduces communication overhead by approximately 50% while defending a

    Distributed Machine Learning @feddit.org
    blueberry @feddit.org

    BitTorrent-based Gossip Learning

    Abstract: Distributed machine learning (DML) may become an important component of IoT device fleets and smart homes in the future. However, it currently presents challenges where reliable (or frequent) internet connectivity is necessary, or trust is not handled. Since DML is generally decentralized and often relies on peer-to-peer networks, we argue that BitTorrent as a time-proven protocol in this space could aid in building a solution. This paper explores the possibilities of employing BitTorrent mechanisms for gossip-based DML. It provides initial evidence supporting the viability of this approach by analysing the behaviour of model training in a simulator representing 30 individual peers with distinct data sets.

    Distributed Machine Learning @feddit.org
    blueberry @feddit.org

    Private Federated Learning In Real World Application - A Case Study

  • Good classification of different degrees of decentrality for machine learning: https://arxiv.org/pdf/2306.01603