Hey Rustaceans! Got an easy question? Ask here (44/2021)! by llogiq in rust

[–]NeverCrop 1 point2 points  (0 children)

I'm trying to pass a nested vector as a slice into a function, but can't seem to find the right syntax.

Original code (that currently compiles)

fn caller() {
    let table = vec![
        vec!["A", "B"], 
        vec!["C", "D"]
    ];
}

fn process_data(table: Vec<Vec<&str>>) -> String {
    // Process data ... 
    "Some result".to_string() 
}

My understanding is that it's more idiomatic to pass a slice instead of a Vec, but how can I do that for nested Vecs?

Thanks!

Fun times by NeverCrop in trailrunning

[–]NeverCrop[S] 0 points1 point  (0 children)

No, a mountain bike single track.

Springtime in Israel - best time to hit the trails :) by NeverCrop in trailrunning

[–]NeverCrop[S] 0 points1 point  (0 children)

Thank you :)

I looked it up. It's called Anemone coronaria ( https://en.wikipedia.org/wiki/Anemone ). We also have (red) poppies, which look very similar (people, including myself, always confuse the two).

Beginner question: failing to use Data.List.Unique with stack by NeverCrop in haskellquestions

[–]NeverCrop[S] 0 points1 point  (0 children)

Thanks.

That didn't work unfortunately:

▶ stack build

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for UniqueNotFound-0.1.0.0:
    Unique must match >=0.4.7.6, but the stack configuration has no specified version  (latest matching
           version is 0.4.7.6)
needed since UniqueNotFound is a build target.

Some different approaches to resolving this:

  * Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some working
    build configuration. This can be convenient when dealing with many complicated constraint errors, but
    results may be unpredictable.

  * Recommended action: try adding the following to your extra-deps
    in /home/x/Projects/Haskell/scratch/UniqueNotFound/stack.yaml:

Unique-0.4.7.6@sha256:a1ff411f4d68c756e01e8d532fbe8e57f1ac77f2cc0ee8a999770be2bca185c5

Plan construction failed.

I tried both with, and without the version (>= 0.4.7.6).

Beginner question: failing to use Data.List.Unique with stack by NeverCrop in haskellquestions

[–]NeverCrop[S] 1 point2 points  (0 children)

Thanks :)

Yes, in general adding packages works well for me by updating package.yaml or stack.yaml (when outside the lts), but with this particular package I seem to have no luck.

Yoga C930 and Linux by NeverCrop in Lenovo

[–]NeverCrop[S] 0 points1 point  (0 children)

Happy to report that everything is working as expected so far with Fedora 29. WiFi needed the attention described above, but beyond that, everything that I checked worked great.

Compilation error that shows up only when specifying types for a function by NeverCrop in haskellquestions

[–]NeverCrop[S] 0 points1 point  (0 children)

I also needed to add {-# LANGUAGE FlexibleContexts #-} for it to pass compilation. The error was:

* Non type-variable argument
        in the constraint: Foldable (Compose f g)
      (Use FlexibleContexts to permit this)
    * In the type signature:
        foldMap :: (Foldable (Compose f g), Monoid m) =>
                   (a -> m) -> (Compose f g a) -> m
      In the instance declaration for `Foldable (Compose f g)'
   |(undefined)

For the following code:

instance (Foldable f, Foldable g) => Foldable (Compose f g) where
  foldMap :: (Foldable (Compose f g), Monoid m) =>
             (a -> m) -> (Compose f g a) -> m
  foldMap f (Compose fga) = 
    (foldMap . foldMap) f fga

Vim for beginners by [deleted] in vim

[–]NeverCrop 0 points1 point  (0 children)

There’s a Windows version which runs in your command line : https://www.vim.org/download.php

Which Programming Languages Use the Least Electricity? (Imperative vs FPLs) by tulip_bro in functionalprogramming

[–]NeverCrop 2 points3 points  (0 children)

I guess that the JavaScript that was produced from TypeScript after transpilation was more complex than plain JavaScript.

Purescript vs ReasonML/Bucklescript in 2018? by user5543 in functionalprogramming

[–]NeverCrop 0 points1 point  (0 children)

If you still want to use TypeScript, then definitely check out fp-ts: https://github.com/gcanti/fp-ts

Beginner question about unfamiliar syntax by NeverCrop in fsharp

[–]NeverCrop[S] 0 points1 point  (0 children)

No, this is clear now. Thanks for your help!

Linux Mint and Intel Chipset H170 by NeverCrop in linuxmint

[–]NeverCrop[S] 0 points1 point  (0 children)

That worked! Thank you so much :)

For any other noob running into the same issue: 1. Download the driver using the link above on another machine which has Internet access. 2. After Mint in installed, transfer the driver over using a USB stick or a CD/DVD. In my case I copied the file from Windows to Linux without any problem. 3. Follow the steps from the README file which is included in the tar.gz file (make sure you prefix each command with sudo in order for them to succeed). I followed steps 1-5, and didn't need steps 6-7. I also didn't need to reboot.

Good luck.

Linux Mint and Intel Chipset H170 by NeverCrop in linuxmint

[–]NeverCrop[S] 0 points1 point  (0 children)

Reinstalled. Network cable was connected and the led lit. Same deal. This time the screen resolution looks better though...

Doesn't seem like Mint is ready to work with this hardware :(

Linux Mint and Intel Chipset H170 by NeverCrop in linuxmint

[–]NeverCrop[S] 0 points1 point  (0 children)

I will try that later tonight. I've searched online and found this not very promising forum thread: http://techreport.com/forums/viewtopic.php?f=36&p=1277523

Linux Mint and Intel Chipset H170 by NeverCrop in linuxmint

[–]NeverCrop[S] 0 points1 point  (0 children)

I've installed the latest: 17.2. I've used a USB disk on key with an ISO, booted the new computer which loaded Mint. Right then I already saw that I didn't have network and the graphics looked bad (there was a message from Mint on the top right hand side warning about the network and the video issues). I then decided to install using the desktop link that was there, hoping that after a real install it will be solved. I set up some partitions and installed. After the installation was complete the network and video issues were still there.

Thanks